package com.wq.gof.designer.chain.list;

import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author: wangqiang20995
 * @Date:2019/1/25
 * @Description:
 * @Resource:
 */
public class ChainHandlerTest {

    public static void main(String args[]){
        HandlerContext handlerContext = new HandlerContext();

        ListEventHandler listEventHandler = new ListEventHandler(handlerContext);

        MapEventHandler mapEventHandler = new MapEventHandler(handlerContext);

        SentinelObjectEventHandler sentinelObjectEventHandler = new SentinelObjectEventHandler(handlerContext);

        handlerContext.addLastHandler(listEventHandler);
        handlerContext.addLastHandler(mapEventHandler);
        handlerContext.addLastHandler(sentinelObjectEventHandler);

        handlerContext.doHandler(new Date());
        System.out.println("-----------------------------------");

        Map<String,Integer> map = new HashMap<>();
        map.put("one",1);
        map.put("two",2);
        map.put("three",3);
        handlerContext.doHandler(map);
        System.out.println("-----------------------------------");
        handlerContext.doHandler(Arrays.asList(new String[]{"Hello","World"}));
    }
}
